﻿using System;
using System.Drawing;
using Microsoft.DirectX;
using Microsoft.DirectX.Direct3D;
using cz.zcu.PreSti.DirectX;
using System.Collections.Generic;

namespace cz.zcu.PreSti.Components
{
    public class Setter : RunnableComponent
    {
        private Subdiagram diagram;
        private int setterIndex = 0;
        private object setterValue = null;

        public Setter(IPresentation p, Subdiagram diagram = null)
            : base(p, 0, 0, 0, 1)
        {
            this.diagram = diagram;
        }

        #region parameters

        public Subdiagram Diagram
        {
            get
            {
                return diagram;
            }
            set
            {
                diagram = value;
            }
        }

        public int SetterIndex
        {
            get
            {
                return setterIndex;
            }
            set
            {
                setterIndex = value;
            }
        }

        public object Value
        {
            get
            {
                return setterValue;
            }
            set
            {
                setterValue = value;
            }
        }

        #endregion

        public override object getValueFromGetter(int getterN)
        {
            if (diagram != null) diagram.updateSetters();
            switch (getterN)
            {
                case 0:
                    return setterValue;
            }
            return base.getValueFromGetter(getterN);
        }

        public override void update() { }

        public new void trigIn(int n) { }

        private void onFinished(object sender, EventArgs e) { }
    }
}